<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
class PHPExcel_Reader_Excel5_Escher
{
    private $data;
    private $dataSize;
    private $pos;
    private $object;
    const DGGCONTAINER = 61440;
    const BSTORECONTAINER = 61441;
    const DGCONTAINER = 61442;
    const SPGRCONTAINER = 61443;
    const SPCONTAINER = 61444;
    const DGG = 61446;
    const BSE = 61447;
    const DG = 61448;
    const SPGR = 61449;
    const SP = 61450;
    const OPT = 61451;
    const CLIENTTEXTBOX = 61453;
    const CLIENTANCHOR = 61456;
    const CLIENTDATA = 61457;
    const BLIPJPEG = 61469;
    const BLIPPNG = 61470;
    const SPLITMENUCOLORS = 61726;
    const TERTIARYOPT = 61730;
    public function __construct($object)
    {
        $this->object = $object;
    }
    public function load($data)
    {
        $this->data = $data;
        $this->dataSize = strlen($this->data);
        $this->pos = 0;
        while ($this->pos < $this->dataSize) {
            $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
            switch ($fbt) {
                case 61440:
                    $this->readDggContainer();
                    break;
                case 61446:
                    $this->readDgg();
                    break;
                case 61441:
                    $this->readBstoreContainer();
                    break;
                case 61447:
                    $this->readBSE();
                    break;
                case 61469:
                    $this->readBlipJPEG();
                    break;
                case 61470:
                    $this->readBlipPNG();
                    break;
                case 61451:
                    $this->readOPT();
                    break;
                case 61730:
                    $this->readTertiaryOPT();
                    break;
                case 61726:
                    $this->readSplitMenuColors();
                    break;
                case 61442:
                    $this->readDgContainer();
                    break;
                case 61448:
                    $this->readDg();
                    break;
                case 61443:
                    $this->readSpgrContainer();
                    break;
                case 61444:
                    $this->readSpContainer();
                    break;
                case 61449:
                    $this->readSpgr();
                    break;
                case 61450:
                    $this->readSp();
                    break;
                case 61453:
                    $this->readClientTextbox();
                    break;
                case 61456:
                    $this->readClientAnchor();
                    break;
                case 61457:
                    $this->readClientData();
                    break;
                default:
                    $this->readDefault();
            }
        }
        return $this->object;
    }
    private function readDefault()
    {
        $verInstance = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos);
        $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
        $recVer = (15 & $verInstance) >> 0;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readDggContainer()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
        $this->object->setDggContainer($dggContainer);
        $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
        $reader->load($recordData);
    }
    private function readDgg()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readBstoreContainer()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
        $this->object->setBstoreContainer($bstoreContainer);
        $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
        $reader->load($recordData);
    }
    private function readBSE()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
        $this->object->addBSE($BSE);
        $BSE->setBLIPType($recInstance);
        $btWin32 = ord($recordData[0]);
        $btMacOS = ord($recordData[1]);
        $rgbUid = substr($recordData, 2, 16);
        $tag = PHPExcel_Reader_Excel5::getInt2d($recordData, 18);
        $size = PHPExcel_Reader_Excel5::getInt4d($recordData, 20);
        $cRef = PHPExcel_Reader_Excel5::getInt4d($recordData, 24);
        $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28);
        $unused1 = ord($recordData[32]);
        $cbName = ord($recordData[33]);
        $unused2 = ord($recordData[34]);
        $unused3 = ord($recordData[35]);
        $nameData = substr($recordData, 36, $cbName);
        $blipData = substr($recordData, 36 + $cbName);
        $reader = new PHPExcel_Reader_Excel5_Escher($BSE);
        $reader->load($blipData);
    }
    private function readBlipJPEG()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $pos = 0;
        $rgbUid1 = substr($recordData, 0, 16);
        $pos += 16;
        if(in_array($recInstance, [1131, 1763])) {
            $rgbUid2 = substr($recordData, 16, 16);
            $pos += 16;
        }
        $tag = ord($recordData[$pos]);
        $pos += 1;
        $data = substr($recordData, $pos);
        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
        $blip->setData($data);
        $this->object->setBlip($blip);
    }
    private function readBlipPNG()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $pos = 0;
        $rgbUid1 = substr($recordData, 0, 16);
        $pos += 16;
        if($recInstance == 1761) {
            $rgbUid2 = substr($recordData, 16, 16);
            $pos += 16;
        }
        $tag = ord($recordData[$pos]);
        $pos += 1;
        $data = substr($recordData, $pos);
        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
        $blip->setData($data);
        $this->object->setBlip($blip);
    }
    private function readOPT()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $this->readOfficeArtRGFOPTE($recordData, $recInstance);
    }
    private function readTertiaryOPT()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readSplitMenuColors()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readDgContainer()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
        $this->object->setDgContainer($dgContainer);
        $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
        $escher = $reader->load($recordData);
    }
    private function readDg()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readSpgrContainer()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
        if($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
            $this->object->setSpgrContainer($spgrContainer);
        } else {
            $this->object->addChild($spgrContainer);
        }
        $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
        $escher = $reader->load($recordData);
    }
    private function readSpContainer()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
        $this->object->addChild($spContainer);
        $this->pos += 8 + $length;
        $reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
        $escher = $reader->load($recordData);
    }
    private function readSpgr()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readSp()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readClientTextbox()
    {
        $recInstance = (65520 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readClientAnchor()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
        $c1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 2);
        $startOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 4);
        $r1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 6);
        $startOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 8);
        $c2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 10);
        $endOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 12);
        $r2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 14);
        $endOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 16);
        $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
        $this->object->setStartOffsetX($startOffsetX);
        $this->object->setStartOffsetY($startOffsetY);
        $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
        $this->object->setEndOffsetX($endOffsetX);
        $this->object->setEndOffsetY($endOffsetY);
    }
    private function readClientData()
    {
        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);
        $this->pos += 8 + $length;
    }
    private function readOfficeArtRGFOPTE($data, $n)
    {
        $splicedComplexData = substr($data, 6 * $n);
        for ($i = 0; $i < $n; $i++) {
            $fopte = substr($data, 6 * $i, 6);
            $opid = PHPExcel_Reader_Excel5::getInt2d($fopte, 0);
            $opidOpid = (16383 & $opid) >> 0;
            $opidFBid = (16384 & $opid) >> 14;
            $opidFComplex = (32768 & $opid) >> 15;
            $op = PHPExcel_Reader_Excel5::getInt4d($fopte, 2);
            if($opidFComplex) {
                $complexData = substr($splicedComplexData, 0, $op);
                $splicedComplexData = substr($splicedComplexData, $op);
                $value = $complexData;
            } else {
                $value = $op;
            }
            $this->object->setOPT($opidOpid, $value);
        }
    }
}

?>